#pragma once

#include <vector>
#include "ChatUtils.h"

enum
{
	C_S_GET_FRIENDLIST,
	S_C_GET_FRIENDLIST,

	C_S_CHAT_MESSAGE,
	S_C_CHAT_MESSAGE,

	C_S_SET_FRIEND_INFO,
};



class FakeNetModule
{
public Dui_Signals:
	sigslot::Signal<int, const StringList& > clientRecvMessage;
	sigslot::Signal<int, const StringList& > serverRecvMessage;

public:
	~FakeNetModule() {}

	static FakeNetModule& Instance()
	{
		static FakeNetModule net;
		return net;
	}

	void SendMessage(int msgId, const StringList& msg)
	{
		{ //-----------------------------------------------
			std::vector<int> sendByClientMsg = {
				C_S_CHAT_MESSAGE, C_S_GET_FRIENDLIST
			};

			auto it = std::find(sendByClientMsg.begin(), sendByClientMsg.end(), msgId);
			if (it != sendByClientMsg.end())
			{
				serverRecvMessage(msgId, msg);
			}
		}

		{ //--------------------------------------------------
			std::vector<int> sendByServerMsg = {
						S_C_CHAT_MESSAGE, S_C_GET_FRIENDLIST
			};

			auto it = std::find(sendByServerMsg.begin(), sendByServerMsg.end(), msgId);
			if (it != sendByServerMsg.end())
			{
				clientRecvMessage(msgId, msg);
			}
		}
	}

private:
	FakeNetModule() {}
	FakeNetModule(const FakeNetModule&) = delete;
	FakeNetModule(FakeNetModule&&) = delete;
};